package com.example.yuanboot.common.config.activiti;

import org.activiti.engine.impl.db.DbIdGenerator;
import org.activiti.engine.impl.event.EventSubscriptionPayloadMappingProvider;
import org.activiti.runtime.api.impl.VariablesMappingProvider;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.DefaultActivityBehaviorFactoryMappingConfigurer;
import org.activiti.spring.process.ProcessVariablesInitiator;
import org.springframework.context.annotation.Configuration;

/**
 * 工作流
 *
 * @author qingyan 2021-08-20
 */
//@Configuration
public class ActivitiConfig extends DefaultActivityBehaviorFactoryMappingConfigurer {

    /*@Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        processEngineConfiguration.setIdGenerator(new DbIdGenerator());
    }*/

    public ActivitiConfig(VariablesMappingProvider variablesMappingProvider, ProcessVariablesInitiator processVariablesInitiator, EventSubscriptionPayloadMappingProvider eventSubscriptionPayloadMappingProvider) {
        super(variablesMappingProvider, processVariablesInitiator, eventSubscriptionPayloadMappingProvider);
    }

    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        super.configure(processEngineConfiguration);
        processEngineConfiguration.setIdGenerator(new DbIdGenerator());
    }
}
